package com.googlecode.spreadit.handler;

import static com.googlecode.spreadit.handler.SpreadRuleHandler.MESSAGE_BUNDLE_KEY;
import static com.googlecode.spreadit.handler.SpreadRuleHandler.RULE_BUNDLE_KEY;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.AndroidRuntimeException;

import com.googlecode.spreadit.bean.Message;
import com.googlecode.spreadit.bean.SpreadRule;

/**
 * This handler {@link Activity} receives application-internal
 * {@value #HANDLER_ID} actions. Upon these actions an e-mail is sent. The
 * content and recipients of the e-mail are given in the {@link Intent}'s
 * extras.
 * 
 * TODO: This handler is currently just a mock implementation and not
 * implemented yet.
 * 
 * @see OutgoingSmsHandler
 * @see OutgoingWhatsAppHandler
 * 
 * @author Markus L. Dechert (markus.dechert@googlemail.com)
 */
public class OutgoingEmailHandler extends Activity {

	public static final String HANDLER_ID = "com.googlecode.spreadit.ACTION_HANDLE_EMAIL";

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	}

	@Override
	protected void onResume() {

		super.onResume();

		if (getIntent() != null && getIntent().getExtras() != null) {

			final Bundle extraBundle = getIntent().getExtras();

			final Message m = (Message) extraBundle.getBundle(
					MESSAGE_BUNDLE_KEY).getSerializable("content");
			final SpreadRule r = (SpreadRule) extraBundle.getBundle(
					RULE_BUNDLE_KEY).getSerializable("content");

			throw new AndroidRuntimeException(this.getClass().getSimpleName()
					+ " is not implemented yet!");
		}
		finish();
	}

}
